home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / aspfor_1 / readme.txt < prev    next >
Encoding:
Text File  |  1999-06-16  |  16.2 KB  |  438 lines

  1. /*                                 
  2.  *   ASP FormMail (BETA) for IIS 2.0+
  3.  *
  4.  *   Version: v1.1b      
  5.  *   Author : Larry [Josh] Ham  (lham@geocel.com)
  6.  *            Geocel International (c) 1999 
  7.  *
  8.  *   Last Modified: 04/26/99
  9.  *   All rights reserved.
  10.  *   -----------------------------
  11.  *
  12.  *   ASP FormMail is designed to mimic Matt Wright's popular perl FormMail script located
  13.  *   at http://www.worldwidemart.com/scripts/  The most important difference is that
  14.  *   ASP FormMail is designed mainly for IIS and does not require any third party programs
  15.  *   such as Perl or SendMail. It is completely handled internally via your web server.
  16.  *
  17.  *   ASP FormMail has been designed around the server-side mail component "DevMailer". 
  18.  *   However, it may be modified to use other compenents. View the README file for
  19.  *   for more information regarding "DevMailer".
  20.  *
  21.  *   Please send bug reports, comments, etc to lham@geocel.com
  22.  *
  23.  *   ASP FormMail may be used and modified free of charge by anyone so long as this
  24.  *   copyright notice and the comments above remain intact.  By using this code
  25.  *   you agree to indemnify Lawrence [Josh] Ham from any liability that might arise
  26.  *   from its use.                                                  
  27.  *                                                                            
  28.  *   Selling the code for this program without prior written consent is     
  29.  *   expressly forbidden. 
  30.  */
  31.  
  32. ASP FormMail is a WWW form to E-mail gateway ASP JScript *port* of the popular 
  33. PERL FormMail script. 
  34.  
  35. ASP FormMail may reside in any directory recognized within the scope of your
  36. IIS Web configuration.
  37.  
  38. A simple HTML implementation would apper as such:
  39.  
  40. ----------
  41. <HTML>
  42. <BODY>
  43.  
  44. <CENTER>
  45. <FORM METHOD="POST" ACTION="ASPFormMail.asp">
  46.     <INPUT TYPE="HIDDEN" NAME="RECIPIENT" VALUE="lham@geocel.com">
  47.     
  48.     <H3>This is a sample</H3>
  49.  
  50.     Enter your favorite color: <INPUT TYPE="TEXT" NAME="Color" SIZE="20">
  51.  
  52.     <INPUT TYPE="SUBMIT" NAME="SEND" VALUE="SEND">
  53.  
  54. </FORM>
  55. </CENTER>
  56.  
  57. </BODY>
  58. </HTML>
  59. ----------
  60.  
  61. There you have a simple web form to e-mail submission form.
  62.  
  63. The following hidden input TAGS are ported directory from FormMail,
  64. thus I will simply leave them as they are in the original FormMail
  65. documentation:
  66.  
  67. ** The following documentation is solely credited to Matt Wright:
  68.  
  69. -- Beginning of Matt Wright's documentation --
  70.  
  71. Necessary Form Fields:
  72. ======================
  73.  
  74. There is only one form field that you must have in your form, for 
  75. FormMail to work correctly.  This is the recipient field.
  76.  
  77. Field:       recipient
  78.  
  79. Description: This form field allows you to specify to whom you wish for your
  80.          form results to be mailed.  Most likely you will want to
  81.          configure this option as a hidden form field with a value equal
  82.          to that of your e-mail address.
  83.  
  84. Syntax:
  85.          <input type=hidden name="recipient" value="email@your.host.com">
  86.  
  87. -----------------------------------------------------------------------------
  88.  
  89. Optional Form Fields:
  90. =====================
  91.  
  92. Field:       subject
  93.  
  94. Description: The subject field will allow you to specify the subject that you
  95.          wish to appear in the e-mail that is sent to you after this form
  96.          has been filled out.  If you do not have this option turned on,
  97.          then the script will default to a message subject: WWW Form
  98.          Submission
  99.  
  100. Syntax:
  101.          If you wish to choose what the subject is:
  102.           <input type=hidden name="subject" value="Your Subject">
  103.  
  104.          To allow the user to choose a subject:
  105.           <input type=text name="subject">
  106.  
  107. -----------------------------------------------------------------------------
  108.  
  109. Field:       email
  110.  
  111. Description: This form field will allow the user to specify their return
  112.          e-mail address.  If you want to be able to return e-mail to your
  113.          user, I strongly suggest that you include this form field and
  114.          allow them to fill it in.  This will be put into the From:
  115.          field of the message you receive.  If you want to require an
  116.          email address with valid syntax, add this field name to the
  117.          'required' field.
  118.  
  119. Syntax:
  120.          <input type=text name="email">
  121.  
  122. -----------------------------------------------------------------------------
  123.  
  124. Field:       realname
  125.  
  126. Description: The realname form field will allow the user to input their real
  127.          name.  This field is useful for identification purposes and will
  128.          also be put into the From: line of your message header.
  129.  
  130. Syntax: 
  131.          <input type=text name="realname">
  132.  
  133. -----------------------------------------------------------------------------
  134.  
  135. Field:       redirect
  136.  
  137. Description: If you wish to redirect the user to a different URL, rather than
  138.          having them see the default response to the fill-out form, you
  139.          can use this hidden variable to send them to a pre-made HTML
  140.          page.
  141.  
  142. Syntax:
  143.          To choose the URL they will end up at:
  144.            <input type=hidden name="redirect" 
  145.                   value="http://your.host.com/to/file.html">
  146.  
  147.          To allow them to specify a URL they wish to travel to once the
  148.          form is filled out:
  149.            <input type=text name="redirect">
  150.  
  151. -----------------------------------------------------------------------------
  152.  
  153. Field:       required
  154.  
  155. Description: You can now require for certain fields in your form to be filled
  156.          in before the user can successfully submit the form.  Simply
  157.          place all field names that you want to be mandatory into this
  158.          field.  If the required fields are not filled in, the user will
  159.          be notified of what they need to fill in, and a link back to
  160.          the form they just submitted will be provided.
  161.  
  162.          To use a customized error page, see 'missing_fields_redirect'
  163.  
  164. Syntax:
  165.          If you want to require that they fill in the email and phone
  166.          fields in your form, so that you can reach them once you have
  167.          received the mail, use a syntax like:
  168.  
  169.            <input type=hidden name="required" value="email,phone">
  170.  
  171. -----------------------------------------------------------------------------
  172.  
  173. Field:       env_report
  174.  
  175. Description: Allows you to have Environment variables included in the
  176.          e-mail message you receive after a user has filled out your
  177.          form.  Useful if you wish to know what browser they were using,
  178.          what domain they were coming from or any other attributes
  179.          associated with environment variables.  The following is a short
  180.          list of valid environment variables that might be useful:
  181.  
  182.          REMOTE_HOST     - Sends the hostname making a request.
  183.          REMOTE_ADDR     - Sends the IP address of the remote host making
  184.                    the request.
  185.          REMOTE_USER     - If server supports authentication and script
  186.                    is protected, this is the username they have
  187.                    authenticated as. *This is not usually set.*
  188.          HTTP_USER_AGENT - The browser the client is using to send the
  189.                    request.  
  190.  
  191.          There are others, but these are a few of the most useful.  For
  192.          more information on environment variables, see:
  193.  
  194.         http://www.cgi-resources.com/Documentation/Environment_Variables/
  195.  
  196. Syntax:
  197.          If you wanted to find the remote host and browser sending the
  198.          request, you would put the following into your form:
  199.  
  200.           <input type=hidden name="env_report" value="REMOTE_HOST,
  201.                                HTTP_USER_AGENT">
  202.  
  203. -----------------------------------------------------------------------------
  204.  
  205. Field:       sort
  206.  
  207. Description: This field allows you to choose the order in which you wish 
  208.          for your variables to appear in the e-mail that FormMail
  209.          generates.  You can choose to have the field sorted
  210.          alphabetically or specify a set order in which you want the
  211.          fields to appear in your mail message.  By leaving this field
  212.          out, the order will simply default to the order in which the 
  213.          browsers sends the information to the script (which is usually
  214.          the exact same order as they appeared in the form.)  When
  215.          sorting by a set order of fields, you should include the phrase
  216.          "order:" as the first part of your value for the sort field, and
  217.          then follow that with the field names you want to be listed in
  218.          the e-mail message, separated by commas.  Version 1.6 allows a
  219.          little more flexibility in the listing of ordered fields, in
  220.          that you can include spaces and line breaks in the field without
  221.          it messing up the sort.  This is helpful when you have many form
  222.          fields and need to insert a line wrap.
  223.  
  224. Syntax:
  225.          To sort alphabetically:
  226.            <input type=hidden name="sort" value="alphabetic">
  227.  
  228.          To sort by a set field order:
  229.            <input type=hidden name="sort" value="order:name1,name2,
  230.                            name3,etc...">
  231.  
  232. -----------------------------------------------------------------------------
  233.  
  234. Field:       print_config
  235.  
  236. Description: print_config allows you to specify which of the config 
  237.          variables you would like to have printed in your e-mail message.
  238.          By default, no config fields are printed to your e-mail.  This
  239.          is because the important form fields, like email, subject, etc.
  240.          are included in the header of the message.  However some users
  241.          have asked for this option so they can have these fields printed
  242.          in the body of the message.  The config fields that you wish to
  243.          have printed should be in the value attribute of your input tag
  244.          separated by commas.
  245.  
  246. Syntax:
  247.          If you want to print the email and subject fields in the body of
  248.          your message, you would place the following form tag:
  249.  
  250.           <input type=hidden name="print_config" value="email,subject">
  251.  
  252. -----------------------------------------------------------------------------
  253.  
  254. Field:       print_blank_fields
  255.  
  256. Description: print_blank_fields allows you to request that all form fields
  257.          are printed in the return HTML, regardless of whether or not
  258.          they were filled in.  FormMail defaults to turning this off, so
  259.          that unused form fields aren't e-mailed.
  260.  
  261. Syntax:
  262.  
  263.          If you want to print all blank fields:
  264.           <input type=hidden name="print_blank_fields" value="1">
  265.  
  266. ----------------------------------------------------------------------------
  267.  
  268. Field:       title
  269.  
  270. Description: This form field allows you to specify the title and header that
  271.          will appear on the resulting page if you do not specify a
  272.          redirect URL.
  273.  
  274. Syntax:
  275.          If you wanted a title of 'Feedback Form Results':
  276.           <input type=hidden name="title" value="Feedback Form Results">
  277.  
  278. -----------------------------------------------------------------------------
  279.  
  280. Field:       return_link_url
  281.  
  282. Description: This field allows you to specify a URL that will appear, as
  283.          return_link_title, on the following report page.  This field
  284.          will not be used if you have the redirect field set, but it is
  285.          useful if you allow the user to receive the report on the
  286.          following page, but want to offer them a way to get back to
  287.          your main page.
  288.  
  289. Syntax:
  290.          <input type=hidden name="return_link_url" 
  291.                          value="http://your.host.com/main.html">
  292.  
  293. -----------------------------------------------------------------------------
  294.  
  295. Field:       return_link_title
  296.  
  297.  
  298. Description: This is the title that will be used to link the user back to the
  299.          page you specify with return_link_url.  The two fields will be
  300.          shown on the resulting form page as:
  301.  
  302.          <ul>
  303.           <li><a href="return_link_url">return_link_title</a>
  304.          </ul>
  305.  
  306. Syntax:
  307.          <input type=hidden name="return_link_title"
  308.                           value="Back to Main Page">
  309.  
  310. -----------------------------------------------------------------------------
  311.  
  312. Field:       missing_fields_redirect
  313.  
  314. Description: This form field allows you to specify a URL that users will be
  315.          redirected to if there are fields listed in the required form
  316.          field that are not filled in.  This is so you can customize an
  317.          error page instead of displaying the default.
  318.  
  319. Syntax:
  320.          <input type=hidden name="missing_fields_redirect"
  321.                     value="http://your.host.com/error.html">
  322.  
  323. -----------------------------------------------------------------------------
  324.  
  325. Field:       background
  326.  
  327. Description: This form field allow you to specify a background image that
  328.          will appear if you do not have the redirect field set.  This
  329.          image will appear as the background to the form results page.
  330.  
  331. Syntax:
  332.          <input type=hidden name="background"
  333.                      value="http://your.host.com/image.gif">
  334.  
  335. -----------------------------------------------------------------------------
  336.  
  337. Field:       bgcolor
  338.  
  339. Description: This form field allow you to specify a bgcolor for the form
  340.          results page in much the way you specify a background image.
  341.          This field should not be set if the redirect field is.
  342.  
  343. Syntax:
  344.          For a background color of White:
  345.           <input type=hidden name="bgcolor" value="#FFFFFF">
  346.  
  347. -----------------------------------------------------------------------------
  348.  
  349. Field:       text_color
  350.  
  351.  
  352. Description: This field works in the same way as bgcolor, except that it
  353.          will change the color of your text.
  354.  
  355. Syntax:
  356.          For a text color of Black:
  357.           <input type=hidden name="text_color" value="#000000">
  358.  
  359. -----------------------------------------------------------------------------
  360.  
  361. Field:       link_color
  362.  
  363. Description: Changes the color of links on the resulting page.  Works in the
  364.          same way as text_color.  Should not be defined if redirect is.
  365.  
  366. Syntax:
  367.          For a link color of Red:
  368.           <input type=hidden name="link_color" value="#FF0000">
  369.  
  370. -----------------------------------------------------------------------------
  371.  
  372. Field:       vlink_color
  373.  
  374. Description: Changes the color of visited links on the resulting page. Works
  375.          exactly the same as link_color.  Should not be set if redirect
  376.          is.
  377.  
  378. Syntax:
  379.          For a visited link color of Blue:
  380.           <input type=hidden name="vlink_color" value="#0000FF">
  381.  
  382. -----------------------------------------------------------------------------
  383.  
  384. Field:       alink_color
  385.  
  386. Description: Changes the color of active links on the resulting page. Works
  387.          exactly the same as link_color.  Should not be set if redirect
  388.          is.
  389.  
  390. Syntax:
  391.          For a visited link color of Blue:
  392.           <input type=hidden name="alink_color" value="#0000FF">
  393.  
  394. -----------------------------------------------------------------------------
  395.  
  396. Any other form fields that appear in your script will be mailed back to 
  397. you and displayed on the resulting page if you do not have the redirect 
  398. field set.  There is no limit as to how many other form fields you can 
  399. use with this form, except the limits imposed by browsers and your server.
  400.  
  401. -----------------------------------------------------------------------------
  402.  
  403. Some of the possible uses of this script are:
  404.  
  405. 1) You want to have a form that will be mailed to you, but aren't sure how to 
  406.    write the CGI script for it.
  407. 2) You are the webmaster of your site and want to allow users to use forms, 
  408.    but not to have their own cgi-bin directories, which can cause 
  409.    security risks to your system.  You can set this script up and then 
  410.    allow all users to run off of it.
  411. 3) Want to have one script to parse all of your html forms and mail them 
  412.    to you.
  413.  
  414. -----------------------------------------------------------------------------
  415.  
  416. -- End of Matt Wright's documentation. --
  417.  
  418. Optional Form Fields:
  419. =====================
  420.  
  421. Field:       FILES
  422.  
  423. Description: The files field can allow for users to choose a file or list
  424.              of files to be included as a file attachment via e-mail. 
  425.              Note: For security purposes, only use filenames, not the full
  426.              path to the files, the path is designated in FORMMAIL.ASP!
  427.  
  428. Syntax:
  429.          If you wish to choose what the files are:
  430.  
  431.              <select NAME="FILES">
  432.              <OPTION VALUE="">-- Select --</OPTION>
  433.              <OPTION VALUE="beans.txt">Attach Bean Documentation</OPTION>
  434.              <OPTION VALUE="com.txt">Attach COM Documentation</OPTION>
  435.              </select>
  436.     
  437.  
  438. -----------------------------------------------------------------------------